<link rel="stylesheet" href="components/com_sale_tsc_che_bien/assets/jquery-ui.css"/>
<link rel="stylesheet" href="components/com_sale_tsc_che_bien/assets/style2.css"/>
<script language="javascript" src="components/com_sale_tsc_che_bien/assets/jquery-1.8.2.js"></script>
<script language="javascript" src="components/com_sale_tsc_che_bien/assets/jquery-ui.js"></script>
<script>
function Refresh()
{
var t=setTimeout("location.reload(true)",5000); //cau hinh thoi gian de reload. hien tai la 5 giay
}
</script>

</head>
<body onload="Refresh()"> 

<?php 
	jimport('joomla.application.component.view');
	//thuc hien goi  model phu hop
	class sale_tsc_che_bienViewsu_luoc_che_bien extends JView
	{
		function display($tpl=null)
		{
	      if(isset($_POST['datepicker']))
            {
                $date = $_POST['datepicker'];
            }
            else
            {
                $date = null;
            }
            $model = $this->getModel();
            $data = $model->ds_don_hang($date);
            //echo "<pre>";
            //echo print_r($data);
            //echo "</pre>"; 
            ?>
                
            <form method="post" action="index.php?option=com_sale_tsc_order&task=su_luoc_ban_hang">
            <p>Date:<input type="text" id="datepicker" name="datepicker" value="<?php echo $date;?>"/>
            <input type="submit" value="Gửi" /></p></form>
            <table border="1">
                <tr>
                    <td>
                        Mã order
                    </td>
                    <td>
                        Sản phẩm order
                    </td>
                     <td>
                        Trạng thái
                    </td>
                </tr>
            <?php                                                                                                                                                                                                                                                                                                                                                
            foreach($data as $row)
            {
                
                       ?> <tr>
                    <td>
                        <?php echo $row->id_order;?>
                    </td>
                    <td><form action="index.php?option=com_sale_tsc_che_bien&task=cap_nhat" method="post">
                    <?php 
                         
                                $data2 = $model->ds_sp_bill($row->id);//echo $row->id;
                                //print_r($data2);
                                ?>
                                
                                    <table border ="1"><input type="hidden" name="bill" value="<?php echo $row->id;?>" />
                                    <?php 
                                        foreach($data2 as $row2)
                                        {
                                            ?>
                                                <tr>
                                                    <td>
                                                        <?php echo $row2->pro_name;?>
                                                    </td>
                                                    <td>
                                                        <?php echo $row2->number;?>
                                                    </td>
                                                    <td>
                                                        <select name="id<?php echo $row2->id_od;?>">
                                                            <option value="0">Chọn tác vụ</option>
                                                            <option value="2">Xóa</option>
                                                            <option value="3" selected="selected">Thành công</option>
                                                        </select>
                                                    </td>
                                                    
                                                    
                                                   
                                                </tr>
                                            <?php
                                        }
                                    ?></table>
                                <?php
                         
                    ?>
                    </td>
                    <td>
                            Mới order
                       
                            
                        </td>
                        <td>
                       <input type="submit" value="Chuyển" /></form>
                                
                            
                        
                        </td>
                        </tr>
                <?php 
                
            }?> </table> <?php
        }
    }?>
    </body>